package com.csair.demo.services.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.csair.demo.dao.IScheduleDao;
import com.csair.demo.pojo.Schedule;
import com.csair.demo.services.IScheduleService;

@Service
public class ScheduleServiceImpl implements IScheduleService {
	
	@Autowired
	private IScheduleDao mapper;

	public List<Schedule> getAllSchedule() throws Exception {
		System.out.println("-------:"+mapper);
		return mapper.getAll("com.csair.demo.mapper.ScheduleMapper.getAll");
	}

	public void saveSchedule(Schedule schedule) throws Exception {
		mapper.add("com.csair.demo.mapper.ScheduleMapper.insert", schedule);
	}

	public void updateSchedule(Schedule schedule) throws Exception {
		mapper.edit("com.csair.demo.mapper.ScheduleMapper.update", schedule);
	}

	public void deleteSchedule(Long id) throws Exception {
		mapper.remove("com.csair.demo.mapper.ScheduleMapper.delete", id);
	}

	public Schedule getScheduleById(Long id) throws Exception {
		return mapper.get("com.csair.demo.mapper.ScheduleMapper.getById", id);
	}



}
